package com.example.teach.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.teach.entity.Academy;
import com.example.teach.mapper.AcademyMapper;
import com.example.teach.service.AcademyService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AcademyServiceImpl extends ServiceImpl<AcademyMapper, Academy> implements AcademyService {
    @Resource
    private AcademyMapper academyMapper;
    @Override
    public void create(Integer academyId, Integer majorId) {
        academyMapper.create(academyId,majorId);
    }

    @Override
    public Academy select(Integer academyId, Integer majorId) {
        return academyMapper.select(academyId,majorId);
    }

    @Override
    public List<Integer> selectmajor(Integer id) {
        return academyMapper.selectmajor(id);
    }

    @Override
    public void deletemajor(Integer academyId, Integer majorId) {
        academyMapper.deletemajor(academyId,majorId);
    }

    @Override
    public boolean isNotEmpty(Integer id) {
        Integer majorId = academyMapper.selectOneByacademyId(id);
        if(majorId == null){
            return false;
        }
        return true;
    }
}
